package mytest.leetcode;

public class P55 {

    public static void main(String[] args) {

        P55 p55 = new P55();

        int[] nums = {1, 2, 3, 4, 5};
        System.out.println(p55.judge(nums));

    }
    public boolean judge(int[] nums) {
        if (nums.length == 0) return true;
        //覆盖最大范围
        int cover = 0;
        for (int i = 0; i <= cover; i++) {

            //最大范围
            cover = Math.max(i + nums[i], cover);
            if (cover >= nums.length - 1){
                return true;
            }
        }
        judge2(nums);
        return false;
    }

    public void judge2(int[] nums) {

    }

}
